#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  ll x, y;
  cin >> x >> y;
  for (int i = 1; i <= n; i++) {
    ll k = x + y;
    string t = to_string(k);
    reverse(t.begin(), t.end());
    k = stoll(t);
    x = y, y = k;
  }
  cout << x << endl;
  return 0;
}
